essentialsdocsfandomcom-20200214-history
Abilities
This page describes how abilities work in Essentials. Defining an ability An ability begins with its definition. This means that is is listed in the PBS file "abilities.txt", so that it can be recognised by the game as an ability. This alone does not give the ability an effect, but you must start by defining it before you can use it. Ability effects An ability is a special effect that the bearer (a Pokémon with that ability) has access to. The vast majority of abilities have unique effects, although there are some which do the same things and just have different names. There is a wide variety of effects an ability can have, from changing stats to inflicting status problems to powering up attacks to preventing escape, and so on. They can be continuous effects, or occur at certain trigger moments (such as when a Pokémon enters battle or at the end of a battle round), or only apply while a certain condition is true, or they can have an effect outside of battle. They can even do a combination of these. As an ability can be so varied in what it does, it is very difficult (if not impossible) to generally describe how to code an ability effect. The best advice is to find an existing ability which does something similar to the new ability you want to create, and copy that and tweak it. See the page List of abilities for all the abilities currently coded in Essentials. Assigning an ability to a Pokémon species Once an ability is defined, you can state that one or more Pokémon species have access to it. An ability can be assigned to a species either as a normal ability or as a hidden ability - these are accessible in different ways. It is impossible for an individual Pokémon to have an ability which has not been defined as being accessible to that Pokémon's species. However, through the use of hidden abilities, it is possible for just a single Pokémon of that species to have a particular ability, if you want to make such a special Pokémon. Normal abilities A Pokémon species can have access to 0, 1 or 2 different abilities as normal abilities. When a Pokémon of that species is generated (e.g. via a wild encounter), its ability will be randomly chosen from all the normal abilities available to that species. Each normal ability has an equal chance of being chosen - the choice depends on the value of the Pokémon's personal ID, which is random. If the Pokémon's personal ID is even, it will have the first normal ability available to its species. If its personal ID is odd, it will have the second normal ability. Obviously this only applies if there are two normal abilities to choose from; if there is just one defined normal ability, the Pokémon will always have that (or no ability if none are defined). You can use one of the following lines of code to force a particular Pokémon's ability to be, respectively, the first or second normal ability defined for its species: pkmn.setAbility(0) pkmn.setAbility(1) where pkmn is the individual Pokémon whose ability you are changing. This sets the Pokémon's ability override flag, where the number is the ability slot you are forcing the Pokémon to use. Slots 0 and 1 are the normal abilities, and slots 2, 3, 4 and 5 are the hidden abilities, in the order they are defined for the species. Hidden abilities In addition to normal abilities, a Pokémon species can also have access to up to 4 different abilities as hidden abilities. An individual Pokémon will never naturally be given one of its hidden abilities; you must use special code to force its ability to be a hidden one. This code is one of the following lines: pkmn.setAbility(2) pkmn.setAbility(3) pkmn.setAbility(4) pkmn.setAbility(5) where pkmn is the individual Pokémon whose ability you are changing. This sets the Pokémon's ability override flag, where the number is the ability slot you are forcing the Pokémon to use. Slots 0 and 1 are the normal abilities, and slots 2, 3, 4 and 5 are the hidden abilities, in the order they are defined for the species. If you set a Pokémon's ability override flag to use a particular slot, but there is no defined ability in that slot, then it will instead behave as though the override flag is not set, i.e. it will use the normal ability it would naturally have, as described above. It will not use a different hidden ability instead.